﻿using Microsoft.AspNetCore.Mvc;
using PMS.Core.Infrastructure;
using PMS.Services.Utils;
using PMS.Web.Framework.Mvc.Filters;

namespace PMS.Web.Framework.Controllers
{
    /// <summary>
    /// Base controller
    /// </summary>
    [HttpsRequirement]
    [SaveLastActivity]
    [SaveLastVisitedPage]
    [ValidatePassword]
    public abstract class BaseController : PMSController
    {
        #region Security

        /// <summary>
        /// Access denied view
        /// </summary>
        /// <returns>Access denied view</returns>
        protected virtual IActionResult AccessDeniedView()
        {
            var webHelper = EngineContext.Current.Resolve<IWebHelper>();

            //return Challenge();
            return RedirectToAction("AccessDenied", "Common", new { pageUrl = webHelper.GetRawUrl(Request) });
        }
        protected virtual IActionResult InvokeHttp404()
        {
            Response.StatusCode = 404;
            return new EmptyResult();
        }

        #endregion

    }
}
